package cn.jtfadmin.activiti.controller.model;

import cn.jtfadmin.base.lang.common.utils.RequestUtils;
import org.springframework.web.bind.annotation.*;

/**
 * 工作流-在线设计器访问rootUrl
 * @author jtf
 * @since 0.0.2
 */
@RestController
public class ExplorerRootPathResource{

    /**
     * 获取在线设计器访问rootUrl js
     * @return rootUrl js
     */
    @ResponseBody
    @RequestMapping(value="/activiti/editor-app/app-cfg.js", method = RequestMethod.GET, produces = "application/javascript; charset=utf-8")
    public String getAppCfgJs() {
        return "'use strict';"+
        "var ACTIVITI = ACTIVITI || {};"+
        "ACTIVITI.CONFIG = { 'contextRoot' : '"+ RequestUtils.getRequest().getContextPath() +"'}";
    }
}
